﻿<catel:DataWindow x:Class="Catel.Examples.SL4.PersonApplication.Views.PersonWindow"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                  xmlns:Converters="clr-namespace:Catel.Examples.SL4.PersonApplication.Data.Converters"
                  xmlns:catel="http://catel.codeplex.com"
                  xmlns:ViewModels="clr-namespace:Catel.Examples.SL4.PersonApplication.ViewModels"
                  mc:Ignorable="d" 
                  d:DataContext="{d:DesignInstance ViewModels:DesignPersonViewModel, IsDesignTimeCreatable=True}">

    <!-- Resources -->
    <catel:DataWindow.Resources>
        <!-- Converters -->
        <Converters:GenderToIsSelectedConverter x:Key="GenderToIsSelectedConverter" />
    </catel:DataWindow.Resources>

    <!-- Content -->
    <catel:StackGrid>
        <!-- Row definitions -->
        <catel:StackGrid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </catel:StackGrid.RowDefinitions>

        <!-- Column definitions -->
        <catel:StackGrid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" MinWidth="300" />
        </catel:StackGrid.ColumnDefinitions>

        <!-- Gender -->
        <TextBlock Text="Gender" />
        <StackPanel Orientation="Horizontal" x:Name="genderStackPanel">
            <RadioButton Content="Male" IsChecked="{Binding Gender, Mode=TwoWay, Converter={StaticResource GenderToIsSelectedConverter}, ConverterParameter=Male, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />
            <RadioButton Content="Female" IsChecked="{Binding Gender, Mode=TwoWay, Converter={StaticResource GenderToIsSelectedConverter}, ConverterParameter=Female, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />
        </StackPanel>

        <!-- First name -->
        <TextBlock Text="First name" />
        <TextBox Text="{Binding FirstName, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />

        <!-- Middle name -->
        <TextBlock Text="Middle name" />
        <TextBox Text="{Binding MiddleName, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />

        <!-- Last name -->
        <TextBlock Text="Last name" />
        <TextBox Text="{Binding LastName, Mode=TwoWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}" />

        <!-- Static binding test -->
        <TextBlock Text="Static binding test" />
        <TextBlock Text="{Binding StaticValue}" />
    </catel:StackGrid>
</catel:DataWindow>